package com.rico.queue.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.rico.provider.RibbonProvider;
import com.rico.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @Autowired
    RibbonProvider ribbonProvider;
    @Autowired
    private TestService testService;

    @RequestMapping("/test")
    @ResponseBody
    public String test(){
        return ribbonProvider.add();
    }
    @RequestMapping("/add")
    @ResponseBody
    public Integer add(Integer a,Integer b) {
    	return a+b;
    }

    @RequestMapping("/testSentinel")
    @ResponseBody
    @SentinelResource(value = "testSentinel1")
    public String testSentinel(){
        return testService.testSentinel();
    }
}
